﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace CoVanHocTapProject
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            #region admin
            routes.MapRoute(
                "TaoQuyDinhChuanDauRa", // Route name
                "admin/qdChuanDauRa", // URL with parameters
                new { controller = "Admin", action = "TaoQuyDinhChuanDauRa", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "SuaQuyDinhChuanDauRa", // Route name
                "admin/suaqdChuanDauRa/{chuanID}", // URL with parameters
                new { controller = "Admin", action = "SuaQuyDinh", chuanID = UrlParameter.Optional } // Parameter defaults
            );


            routes.MapRoute(
                "AdminChatbot", // Route name
                "admin/chatbot", // URL with parameters
                new { controller = "Admin", action = "NhapDLChat", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "AdminTTCN", // Route name
                "admin/ttcn", // URL with parameters
                new { controller = "TrangChu_Admin", action = "ThongTinCaNhan", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "DangNhapAdmin", // Route name
                "admin/dangnhap", // URL with parameters
                new { controller = "TrangChu_Admin", action = "DangNhapAdmin", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "Thoat", // Route name
                "admin/thoat", // URL with parameters
                new { controller = "TrangChu_Admin", action = "ThoatAdmin", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "TrangChuAdmin", // Route name
                "admin", // URL with parameters
                new { controller = "TrangChu_Admin", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "Report1", // Route name
                "admin/report", // URL with parameters
                new { controller = "Report", action = "ReportMonHoc", id = UrlParameter.Optional } // Parameter defaults
            );

            #endregion

            routes.MapRoute(
                "chatter", // Route name
                "chat", // URL with parameters
                new { controller = "Chatterbot", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );



            routes.MapRoute(
                "lotrinhCN2", // Route name
                "cn2/lotrinhCN2", // URL with parameters
                new { controller = "ChuyenNganh2", action = "LoTrinhHocTapCN2", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "lotrinhCN2UC", // Route name
                "cn2/lotrinhCN2UC", // URL with parameters
                new { controller = "ChuyenNganh2", action = "LoTrinhHocTapCN2UC", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "goiyCN2", // Route name
                "cn2/goiy", // URL with parameters
                new { controller = "ChuyenNganh2", action = "GoiYChuyenNganh2", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "goiyCN2UC", // Route name
                "cn2/goiyUC", // URL with parameters
                new { controller = "ChuyenNganh2", action = "GoiYChuyenNganh2UC", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "dkkhht", // Route name
                "khht/dky", // URL with parameters
                new { controller = "KeHoachHocTap", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "hocVuotHocChamUC", // Route name
                "ctdt/lthvhcUC", // URL with parameters
                new { controller = "ChuongTrinhDaoTaoChuan", action = "LoTrinhHocVuotHocChamUC", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "hocVuotHocCham", // Route name
                "ctdt/lthvhc", // URL with parameters
                new { controller = "ChuongTrinhDaoTaoChuan", action = "LoTrinhHocVuotHocCham", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "ctdtchuan", // Route name
                "ctdt/ctdtchuan", // URL with parameters
                new { controller = "ChuongTrinhDaoTaoChuan", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "lotrinhhoctapchitiet", // Route name
                "ctdt/lotrinhchitiet", // URL with parameters
                new { controller = "ChuongTrinhDaoTaoChuan", action = "LoTrinhHocTapChiTiet", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "lotrinhhoctapchitietUC", // Route name
                "ctdt/lotrinhchitietUC", // URL with parameters
                new { controller = "ChuongTrinhDaoTaoChuan", action = "LoTrinhHocTapChiTietUC", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "QuenMK", // Route name
                "mk", // URL with parameters
                new { controller = "TrangChu", action = "QuenMatKhau", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "DangNhapTC", // Route name
                "dangnhapTC", // URL with parameters
                new { controller = "TrangChu", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "DangNhap", // Route name
                "dangnhap", // URL with parameters
                new { controller = "TrangChu", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "TrangChu", // Route name
                "TrangChu", // URL with parameters
                new { controller = "TrangChu", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "TrangChu", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );



            routes.MapRoute(
                "TinChiTichLuyBatBuoc",
                "{controller}/{action}/{id}",
                new { controller = "TheoDoiSinhVien", action = "TinChiTichLuyBatBuoc", id = UrlParameter.Optional }
                );

            routes.MapRoute(
                "ImportDiemDGRL",
                "{controller}/{action}/{id}",
                new { controller = "Admin", action = "ImportDiemDGRL", id = UrlParameter.Optional }
            );

            routes.MapRoute(
                "UploadDiemRL",
                "Upload",
                new { controller = "FileUpload", action = "FileUpload", id = UrlParameter.Optional }
            );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }

        protected void Application_BeginRequest()
        {
            HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
            HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
            HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            HttpContext.Current.Response.Cache.SetNoStore();



        }
    }
}